/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aybolit.core.objects.dao.impl;


import aybolit.core.objects.dao.DepartmentDao;
import aybolit.core.objects.model.Departments;
import java.io.Serializable;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Masumov Emin
 */

@Transactional
public class DepartmentDaoImpl extends DAO implements DepartmentDao,Serializable{
SessionFactory sessionFactory;
    
    @Transactional
    @Override
    public List<Departments> findAllDepartment() {
       return sessionFactory.getCurrentSession().getNamedQuery("Departments.findAllDepartmentsByDepId").setParameter("dep_id", getOperator().getDepartmentId()).list();     
    }
    @Resource(name = "sessionFactory")
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
   
}
